﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>
  
</head>

<body>

  <%@ include file="/WEB-INF/include/header.jsp"%>

  <%@ include file="/WEB-INF/include/menu.jsp"%>

  <div class="container main-content">

    <div class="panel panel-default x-panel x-panel-layout">

      <div class="panel-heading">
        <ol class="breadcrumb">
          <li><a href="${ctx.host}/report">报表</a></li>
          <li class="active">报表</li>
        </ol>
      </div>

      <div class="panel-body">

        <div class="col-xs-2 x-panel-layout-left no-horizontal-padding">
          <%@ include file="/WEB-INF/include/submenu.jsp"%>
        </div>

        <div class="col-xs-10 x-panel-layout-right">

          <div class="x-breadcrumb-wrapper">
            <div class="x-breadcrumb clearfix">
              <h2><i class="glyphicon glyphicon-fire"></i>&nbsp;&nbsp;<span>报表&nbsp;-&nbsp;inbody数据报表</span></h2>
              <div class="pull-right">
                <c:choose>
                  <c:when test="${not empty currentPrincipal.site}">
                    <span class="current-branchCode">${currentPrincipal.site.name}</span>
                  </c:when>
                  <c:otherwise>
                    <select name="site">
                      <option value="">全部门店</option>
                      <c:forEach var="site" items="${persist.mapSites}">
                        <option value="${site.value.id}" ${site.value.id == selectedSiteId ? 'selected' : ''}>${site.value.name}</option>
                      </c:forEach>
                    </select>
                  </c:otherwise>
                </c:choose>
              </div>
            </div>
          </div>
          
          <div class="form-horizontal clearfix" style="margin-bottom: 20px">
            <!-- <div class="btn-group pull-right">
              <a href="${ctx.host}/student-reports/export?site=${selectSite.id}" title="" class="btn btn-default x-btn btn-shadow btn-shadow-default">
                <i class="glyphicon glyphicon-arrow-down"></i>&nbsp;&nbsp;导出
              </a>
            </div> -->
            <div class="btn-group pull-right">
              <a href="${ctx.host}/inbody-reports/search?site=${selectedSiteId}" data-target="#" data-toggle="modal"  class="btn btn-default x-btn btn-shadow btn-shadow-default">
                <i class="glyphicon glyphicon-search"></i>&nbsp;&nbsp;过滤查询
              </a>
            </div>
          </div>
          
            
          <table class="table table-striped table-hover x-table" style="margin-bottom:20px;">
            <thead>
              <tr>
                <th>姓名<br />手机</th>
                <th>来源</th>
                <th>年龄<br />性别</th>
                <th>体重</th>
                <th>骨骼肌</th>
                <th>体脂肪</th>
                <th>体脂率</th>
                <th>BMI值</th>
                <th>腰臀比</th>
                <th>基础代谢</th>
                <th>测试时间</th>
              </tr>
            </thead>
            <tbody>
              <c:forEach var="result" items="${inbodyRecords}">
              
                <c:forEach var="inbodyRecord" items="${result.value}" varStatus="status">
                  <tr>
                    <c:if test="${status.index == 0}">
                      <th rowspan="${fn:length(result.value)}">${persist.studentName(result.key)}</th>
                    </c:if>
                    <td>${inbodyRecord.source}</td>
                    <td>${inbodyRecord.age}<br />${inbodyRecord.gender.description}</td>
                    <td>${inbodyRecord.weightMax}/${inbodyRecord.weightMin}<br />${inbodyRecord.weight}<br />${inbodyRecord.weightLabel}</td>
                    <td>${inbodyRecord.smMax}/${inbodyRecord.smMin}<br />${inbodyRecord.sm}<br />${inbodyRecord.smLabel}</td>
                    <td>${inbodyRecord.bfMax}/${inbodyRecord.bfMin}<br />${inbodyRecord.bf}<br />${inbodyRecord.bfLabel}</td>
                    <td>${inbodyRecord.bfrMax}/${inbodyRecord.bfrMin}<br />${inbodyRecord.bfr}<br />${inbodyRecord.bfrLabel}</td>
                    <td>${inbodyRecord.bmiMax}/${inbodyRecord.bmiMin}<br />${inbodyRecord.bmi}<br />${inbodyRecord.bmiLabel}</td>
                    <td>${inbodyRecord.whrMax}/${inbodyRecord.whrMin}<br />${inbodyRecord.whr}<br />${inbodyRecord.whrLabel}</td>
                    <td>${inbodyRecord.bmMax}/${inbodyRecord.bmMin}<br />${inbodyRecord.bm}<br />${inbodyRecord.bmLabel}</td>
                    <td>${inbodyRecord.recordTime}</td>
                  </tr>
                </c:forEach>
              </c:forEach>
            </tbody>
          </table>
          
        </div>

      </div>

    </div>

  </div>

  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource root="${ctx.resource}/build" type="script" src="js/page/report/inbody-report.js">
    <script type="text/javascript">
      require(['page/report/inbody-report'], function(page) {
        page.init()
      })
    </script>
  </d:resource>
  
</body>
</html>